<template>
	   <view  class="content" >
		  <view v-if="bool"  v-for="(item,index) in arr" style="float: left; width: 100%; height: 300px;">
			  <view>编号：{{item.bookId}}</view>
			  <view>书名：{{item.bookName}}</view>
			  <view>数量:{{item.num}}</view>
			  <view>作者：{{item.author}}</view> 
			  <view  style="height: 200px;"><image  :src=" item.picture" mode="aspectFill" style="height: 190px; width: 100%;" ></image></view>
			  <button size="mini" style="background-color: #F0AD4E; float: right;" @click="give(index)" >还书</button>
		  </view>
	        <view v-if="!bool" style="font-size: 20px;text-align: center;">欢迎借阅书籍</view>
		   </view>
	   
</template>

<script>
	export default {
		data() {
			return {
				arr:[],
				bool:false,
				bookname:""
			 }
			},
		onLoad() {
			uni.request({
				url:"http://summer.codinglink.tech:8081/book/getAllBooks",
				method:"GET",
				data:{	
				},
				success: (res) => {
					this.arr=res.data.data;
					if(this.arr!=""){
						this.bool=true
					}
				}
			})
			
			

		},
		methods: {
           give(index){
			   uni.showToast({
			   	 icon:"none",
				 title:"还书成功"
			   })
			  console.log(this.arr[index].title)
			  uni.request({
			  	url:"",
				method:"",
				data:{
					          
				},
				success: () => {
					console.log("传输成功")
				}
			  })
		   }
	}	
	}
</script>

<style>
	
</style>
